#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
#include <vector>
#include<queue>
#include<stack>
using namespace std;
#define MAXL 100005
#define mod 998244353
int main()
{
	int n, h[MAXL];
	//stack<int>a;
	stack<pair<int, int> >a;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> h[i];
	}
	vector<int>ans(n+1);
	for (int i = 1; i <= n; i++)
	{
		while (!a.empty() && a.top().first < h[i])
		{
			ans[a.top().second] = i;
			a.pop();
		}
		a.push({ h[i], i });
	}
	for (int i = 1; i <= n; i++)
	{
		cout << ans[i] << endl;
	}
	return 0;
}